home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MCASM.RAR / MC_ASM.EXE / WROX_ASM / CH3 / PROG3_1.ASM < prev   
Assembly Source File  |  1994-11-14  |  3KB  |  90 lines

  1.  
  2. ;////////////////////////////////////////////////////////////
  3. ;Program 3.1.
  4. ;////////////////////////////////////////////////////////////
  5.  
  6. ; PIC_REPR.
  7. ; This program changes the standard initialization
  8. ; set for both PICs (I8259). IRQ0-7 will be serviced through
  9. ; vectors 50-57h.
  10. ;
  11. .DOSSEG
  12. .MODEL small
  13. .DATA
  14. .STACK 100h
  15. .CODE
  16. .STARTUP
  17.             cli                 ;Interrupts are forbidden
  18.  
  19.             call Move8to50  ;Send vectors to the new area
  20.  
  21.             mov bx,5070h;BH:IRQ0-7, BL:IRQ8-15
  22.  
  23.             call Setdef        ;Re-initialize PICs
  24.  
  25.             sti
  26. .EXIT 0
  27.  
  28. Move8to50   PROC near
  29.             mov cx,32
  30.             xor ax,ax
  31.             mov es,ax
  32.             mov ds,ax
  33.             mov si,8*4      ;SI points to the first
  34.                             ;byte of vectors 08-0Fh in the
  35.                             ;Interrupt Vector Table.
  36.             mov di,50h*4    ;DI points to the first
  37.                             ;byte of vectors 50h-57h in
  38.                             ;Interrupt Vector Table.
  39.  
  40. Lab1:       mov bl, BYTE ptr es:[si]
  41.             mov BYTE ptr ds:[di],bl
  42.             mov BYTE ptr es:[si],0
  43.             inc di
  44.             inc si
  45.             loop Lab1
  46.  
  47.             ret
  48. Move8to50   ENDP
  49.  
  50. Setdef      PROC  near
  51.             mov al,11h      ;---+
  52.             out 0A0h,al     ;   | Set ICW1 00010001b
  53.             jmp short $+2   ;   |
  54.             jmp short $+2   ;   |
  55.             out 20h,al      ;---+
  56.             jmp short $+2
  57.             jmp short $+2
  58.             mov al,bl       ;---+
  59.             out 0A1h,al     ;   |01110xxx (BIOS 70-77h)
  60.             jmp short $+2   ;   | Set ICW2
  61.             jmp short $+2   ;   |
  62.             mov al,bh       ;   |
  63.             out 21h,al      ;---+00001xxx (BIOS 8-0Fh)
  64.             jmp short $+2
  65.             jmp short $+2
  66.             mov al,2        ;---+
  67.             out 0A1h,al     ;   |
  68.             jmp short $+2   ;   | Set ICW3
  69.             jmp short $+2   ;   |
  70.             mov al,4        ;   |
  71.             out 21h,al      ;---+
  72.             jmp short $+2
  73.             jmp short $+2
  74.             mov al,1        ;---+
  75.             out 0A1h,al     ;   |
  76.             jmp short $+2   ;   | Set ICW4
  77.             jmp short $+2   ;   |
  78.             out 21h,al      ;---+
  79.             jmp short $+2
  80.             jmp short $+2
  81.             mov al,0        ;---+
  82.             out 0A1h,al     ;   | Set OCW1 (IMR(Mask))
  83.             jmp short $+2   ;   |
  84.             jmp short $+2   ;   |
  85.             out 21h,al      ;---+
  86.             ret
  87. Setdef      ENDP
  88. END
  89.  
  90.